﻿using System;

namespace Segmentation.Business.Criterions
{
    public abstract class Criterion
    {
        #region Fields

        private double value;

        #endregion Fields
        
        #region Properties

        public abstract string Name
        {
            get;
        }

        public double Value
        {
            get
            {
                return this.value;
            }
        }
        
        #endregion Properties
        
        #region Methods

        protected abstract double Calculate(byte[,] mapIdeal, byte[,] mapCalculated);

        public void CalculateCriterion(byte[,] mapIdeal, byte[,] mapCalculated)
        {
            this.value = this.Calculate(mapIdeal, mapCalculated);
        }
        
        public override string ToString()
        {
            return string.Format("{0} = {1}", this.Name, this.value);
        }

        #endregion Methods
    }
}
